home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / gfx / x11 / xfig.lha / doc / FORMAT2.0 < prev    next >
Text File  |  1994-09-07  |  9KB  |  287 lines

  1. The following is the format of fig output for Protocol version 2.0:
  2.  
  3. (1) The very first line is a comment line containing the name and version:
  4.     #FIG 2.0
  5.  
  6.     The character # at the first column of a line indicates that the line
  7.     is a comment line which will be ignored.
  8.  
  9. (2) The first non-comment line consists of two numbers :
  10.  
  11.     int    fig_resolution        (pixels/inch)
  12.     int    coordinate_system    (1 : origin is at the lower left corner
  13.                      2 : Upper left)
  14.  
  15.     Fig_resolution is the resolution fig is using for the current file.
  16.     It may not be the same as screen resolution (which can be higher or
  17.     lower).  I assume that a pixel is square, therefore this number
  18.     represents drawing resolution in both direction.  I've experimented
  19.     with fig automatically changing this number according to the resolution
  20.     of the monitor it is running on (The screen resolution, width and height
  21.     in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
  22.     I've found that for monitors with higher resolution but same size
  23.     (19" diagonal), I preferred using the pixels for other things than
  24.     having fig occupying most of the screen.  Thus I opted for a fixed
  25.     pixel-per-inch number which make fig window smaller on higher resolution
  26.     monitor (than the standard sun monitor).  This however may change in
  27.     the future version.
  28.  
  29. (3) The rest of the file contains various objects.  An object can be one
  30.     of six classes (or types).
  31.  
  32.       i)    Ellipse which is a generalization of circle.
  33.      ii)    Polyline which includes polygon and box.
  34.     iii)    Spline which includes closed/open control/interpolated spline.
  35.      iv)    Text.
  36.       v)    Arc.
  37.      vi)    Compound object which is composed of one or more objects.
  38.  
  39.     In the following elaboration on object formats, every value of fig
  40.     output are separated by blank characters or new line ('\n').  The
  41.     value of the not-used parameters will be -1.
  42.  
  43.     A number of values are described as unused or not applicable to some
  44.     object even though they are defined for those objects.  These value
  45.     will (hopefully) be used in the future version of fig.  The intention
  46.     of their uses are the following.
  47.  
  48.     Value            Usage
  49.     -----            -----
  50.     area_fill    The gray color for filling object internals.
  51.             Non-TFX:(gray color; 0=no fill,1=white,21=black)
  52.             TFX:    (gray color; 0=no fill,1=black, 5=white)
  53.  
  54.     pen        This will be a structure defining the shape of
  55.             pen used in drawing objects.  It also includes
  56.             the the stipple pattern for line filling.
  57.             The default pen is a circular pen with black
  58.             filling.
  59.  
  60.     thickness    Every pen has the thickness of one.
  61.             Thickness scales the size of a pen. 
  62.  
  63.     depth        This value adds a half dimension to fig.
  64.             It is useful when we have overlapping filled
  65.             objects and we want one to obliterate another.
  66.             An object can have only one depth (including
  67.             compound object).  An object that is in less
  68.             depth can obscure the one with greater depth
  69.             if they overlap.
  70.     
  71.     style        Three line styles are defined.
  72.  
  73.                 0 : SOLID_LINE
  74.                 1 : DASH_LINE
  75.                 2 : DOTTED_LINE
  76.  
  77.     style_val    For dash style, it is the length of a dash.
  78.             For dotted line it indicates the approximated
  79.             gap of consecutive dots. 
  80.     
  81.     radius        For rounded-corner boxes, this is the radius of
  82.             the corners.
  83.  
  84.     (3.1) ELLIPSE
  85.  
  86.     First line :
  87.     type    name            (brief description)
  88.     ----    ----            -------------------
  89.     int    object_code        (always 1)
  90.     int    sub_type        (1 : ellipse defined by radiuses
  91.                      2 : ellipse defined by diameters
  92.                      3 : circle defined by radius
  93.                      4 : circle defined by diameter)
  94.     int    style            (See the end of this section)
  95.     int    thickness        (pixels, not used)
  96.     int    color            (not used)
  97.     int    depth            (not used)
  98.     int    pen            (not used)
  99.     int    area_fill        (gray color)
  100.     float    style_val        (pixels, not used)
  101.     int    direction        (always 1)
  102.     float    angle            (radian, the angle of the x-axis)
  103.     int    center_x, center_y    (pixels)
  104.     int    radius_x, radius_y    (pixels)
  105.     int    start_x, start_y    (pixels; the 1st point entered)
  106.     int    end_x, end_y        (pixels; the last point entered)
  107.  
  108.     (3.2) POLYLINE
  109.  
  110.     First line :
  111.     type    name            (brief description)
  112.     ----    ----            -------------------
  113.     int    object_code        (always 2)
  114.     int    sub_type        (1 : polyline, 2 : box, 
  115.                      3 : polygon, 4 : rounded-corner box)
  116.     int    style            (See the end of this section)
  117.     int    thickness        (pixels, not used)
  118.     int    color            (not used)
  119.     int    depth            (not used)
  120.     int    pen            (not used)
  121.     int    area_fill    *    (gray color)
  122.     float    style_val        (pixels)
  123.     int    radius        **    (pixels, radius of rounded-corner boxes)
  124.     int    forward_arrow        (0: off, 1: on)
  125.     int    backward_arrow        (0: off, 1: on)
  126.  
  127. *  Fill only available for box, polygon and rounded-corner box, not polyline.
  128. ** This component exists only in rounded-corner box object.
  129.  
  130.     Forward arrow line : same as ARC object
  131.  
  132.     Backward arrow line : same as ARC object
  133.  
  134.     Points line :
  135.     type    name            (brief description)
  136.     ----    ----            -------------------
  137.     int    x1, y1            (pixels)
  138.     int    x2, y2            (pixels)
  139.       .
  140.       .
  141.     int    xn, yn            (this will be the same as the 1st
  142.                     point for polygon and box)
  143.     int    x, y            (always 9999, 9999; marks the end of
  144.                     point for polygon and box)
  145.  
  146.     (3.3) SPLINE
  147.  
  148.     First line :
  149.     type    name            (brief description)
  150.     ----    ----            -------------------
  151.     int    object_code        (always 3)
  152.     int    sub_type        (0 : open spline
  153.                      1 : closed spline
  154.                      2 : open interpolated spline
  155.                      3 : closed interpolated spline)
  156.     int    style            (See the end of this section)
  157.     int    thickness        (pixels, not used)
  158.     int    color            (not used)
  159.     int    depth            (not used)
  160.     int    pen            (not used)
  161.     int    area_fill        (gray color)
  162.     float    style_val        (pixels, not used)
  163.     int    forward_arrow        (0: off, 1: on)
  164.     int    backward_arrow        (0: off, 1: on)
  165.  
  166.     Forward arrow line : same as ARC object
  167.  
  168.     Backward arrow line : same as ARC object
  169.  
  170.     Points line : same as POLYLINE object
  171.  
  172.     Control points line (absent if sub_type is 1 or 2) :
  173.     Control points of interpolated spline.  There are two control
  174.     points for each knots.  A section i, of the spline is drawn
  175.     using Bezier cubic with the following four points:
  176.         (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  177.           i  i        i    i      i+1    i+1     i+1   i+1
  178.     For closed interpolated spline the last pair of control points,
  179.     (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
  180.     (lx1,ly1) and (rx1,ry1) respectively.
  181.  
  182.     type    name            (brief description)
  183.     ----    ----            -------------------
  184.     float    lx1, ly1        (pixels)
  185.     float    rx1, ry1        (pixels)
  186.     float    lx2, ly2        (pixels)
  187.     float    rx2, ry2        (pixels)
  188.       .
  189.       .
  190.     float    lxn, lyn        (pixels)
  191.     float    rxn, ryn        (pixels)
  192.  
  193.     (3.4) TEXT
  194.     type    name            (brief description)
  195.     ----    ----            -------------------
  196.     int    object             (always 4)
  197.     int    sub_type        (0 : Left justified
  198.                      1 : Center justified
  199.                      2 : Right justified)
  200.     int    font             (font number 0-...)
  201.     int    font_size         (point size)
  202.     int    pen            (not used)
  203.     int    color            (not used)
  204.     int    depth            (not used)
  205.     float    angle            (radian, not used, the angle of the
  206.                     the base line of the string)
  207.     int    font_style        (not used)
  208.     int    height            (pixels)
  209.     int    length            (pixels)
  210.     int    x, y            (pixels, coordinate of the origin
  211.                      of the string.  If sub_type = 0, it is
  212.                      the lower left corner of the string.
  213.                      If sub_type = 1, it is the lower
  214.                      center.  Otherwise it is the lower
  215.                      right corner of the string.)
  216.     char    string[]        (ascii characters; starts after a blank
  217.                     character following the last number and
  218.                     ends before the character '\1'.  This
  219.                     character is not part of the string.
  220.                     Note that the string may contain '\n'.)
  221.     (3.5) ARC
  222.  
  223.     First line :
  224.     type    name            (brief description)
  225.     ----    ----            -------------------
  226.     int    object_code        (always 5)
  227.     int    sub_type        (always    1)
  228.     int    style            (See the end of this section)
  229.     int    line_thickness        (pixels, not used)
  230.     int    color            (not used)
  231.     int    depth            (not used)
  232.     int    pen            (not used)
  233.     int    area_fill        (gray color)
  234.     float    style_val        (pixels, not used)
  235.     int    direction        (0 : clockwise, 1 : counterclockwise)
  236.     int    forward_arrow        (0: no forward arrow, 1: on)
  237.     int    backward_arrow        (0: no forward arrow, 1: on)
  238.     float    center_x, center_y    (center of the arc)
  239.     int    x1, y1            (pixels, the 1st point the user entered)
  240.     int    x2, y2            (pixels, the 2nd point)
  241.     int    x3, y3            (pixels, the last point)
  242.  
  243.     Forward arrow line (Optional; absent if forward_arrow is 0) :
  244.     type    name            (brief description)
  245.     ----    ----            -------------------
  246.     int    arrow_type        (not used)
  247.     int    arrow_style        (not used)
  248.     float    arrow_thickness        (not used)
  249.     float    arrow_width        (pixels)
  250.     float    arrow_height        (pixels)
  251.  
  252.     Backward arrow line (Optional; absent if backward_arrow is 0) :
  253.     type    name            (brief description)
  254.     ----    ----            -------------------
  255.     int    arrow_type        (not used)
  256.     int    arrow_style        (not used)
  257.     float    arrow_thickness        (not used)
  258.     float    arrow_width        (pixels)
  259.     float    arrow_height        (pixels)
  260.  
  261.     (3.6) COMPOUND
  262.  
  263.     A line with object code 6 signifies the start of a compound.
  264.     There are four more numbers on this line which indicate the
  265.     upper right corner and the lower left corner of the bounding
  266.     box of this compound.  A line with object code -6 signifies
  267.     the end of the compound.  Compound may be nested.
  268.  
  269.     First line :
  270.     type    name            (brief description)
  271.     ----    ----            -------------------
  272.     int    object_code        (always 6)
  273.     int    upperright_corner_x    (pixels)
  274.     int    upperright_corner_y    (pixels)
  275.     int    lowerleft_corner_x    (pixels)
  276.     int    lowerleft_corner_y    (pixels)
  277.  
  278.     Subsequent lines :
  279.     objects
  280.     .
  281.     .
  282.  
  283.     Last line :
  284.     -6
  285.  
  286.  
  287.